package com.woniu.controller;

import com.woniu.dto.CreateExamRequestDTO;
import com.woniu.service.ExamService;
import com.woniu.utils.ResponseUtil;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.text.ParseException;

@RestController
@RequestMapping("/api")
public class ExamController {
    @Resource
    private ExamService examService;
    @GetMapping("/exam-items")
    public ResponseUtil getAllExamItems() {
        ResponseUtil result = examService.listAllItems();
        return result;
    }

    @GetMapping("/patient-exams/{patientId}")
    public ResponseUtil getPatientExams(@PathVariable Integer patientId) {
        ResponseUtil result = examService.listExamsByPatient(patientId);
        return result;
    }

    @PostMapping("/patient-exams/batch")
    public ResponseUtil createPatientExams(@RequestBody CreateExamRequestDTO dto) throws ParseException {
        ResponseUtil result = examService.createInpatientExams(dto);
        return result;
    }
}
